package com.hubei.service.impl;

import com.hubei.dao.UserDao;
import com.hubei.service.UserService;
import com.hubei.vo.Users;

import java.util.List;

/**
 * @author PJM
 * @date 2025/6/24-9:13
 */
public class UserServiceImpl implements UserService {

    private UserDao userDao = UserDao.getInstance();

    @Override
    public Users userLogin(Users users) {
        // 进行业务逻辑处理
        return userDao.userLogin(users);
    }

    @Override
    public List<Users> queryUserList(String username) {
        if (username!=null && !"".equals(username)){
            username = "%"+username+"%";
        }
        return userDao.queryUserList(username);
    }

    @Override
    public int insertUser(Users users) {
        return userDao.insertUser(users);
    }

    @Override
    public boolean deleteUser(int id) {
        Boolean b = userDao.queryUser(id);
        if (!b){
            return  false;
        }
        Boolean success =userDao.deleteUser(id);
        if (success){
            return true;
        }
        return false;
    }
}
